# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/30 下午4:57
 @Author  : tgy
 
"""

class Person:
    attrs = ['name', 'age']
    def __init__(self):
        ...

    def __setattr__(self, key, value):
        if key in self.attrs:
            ...
            self.__dict__[key] = value
        else:
            raise Exception(f'{key} attribute is not allow')



if __name__ == '__main__':
    ...
    per = Person()
    per.name = 'zhangsan'
    print(per.name)
    per.score = '12'

